﻿<%@ Page Title="单品有效值计算" Language="C#" MasterPageFile="~/master/m.master" %>
<script runat="server"></script>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
	<link href="../assets/css/shelf/base.css" rel="stylesheet">
	<link href="../assets/css/report/AllocationDetail.css" rel="stylesheet" />
	<link href="../assets/css/plugins/iCheck/customsmall.css" rel="stylesheet" />
	<link href="../assets/css/plugins/bootstrap-select/bootstrap-select.min.css" rel="stylesheet" />
	<link href="../assets/css/plugins/jQuery-DataTables/css/dataTables.bootstrap4.min.css" rel="stylesheet" />
	<link rel="stylesheet" type="text/css" href="../assets/css/plugins/jQuery-DataTables/css/fixedColumns.dataTables.min.css" />

	<style>
		iframe,
		html,
		body,
		.system-box,
		.right-side {
			overflow: hidden !important;
		}
		
		table.dataTable thead .sorting:after {
			content: "" !important;
			float: right;
			font-family: fontawesome;
			color: rgba(50, 50, 50, .5);
		}
		
		.DTFC_LeftWrapper,
		.dataTables_scrollHead {
			border-top: 1px solid #EBEBEB !important;
		}
		
		.inputpadding0 {
			padding: 0 !important;
		}
		
		.condition-container label {
			margin: 0 !important;
		}
		
		.backselect {
			color: #333;
			background-color: #fff;
			border-color: #ccc;
			padding: 6px;
		}
		
		.form-control {
			border-radius: 5px;
		}
		
		.DTFC_LeftBodyLiner {
			-ms-overflow-x: hidden !important;
			overflow-x: hidden !important;
		}
		
		table.dataTable thead th {
			padding: 0 !important;
			text-align: center;
		}
		
		.border-bottom-white {
			border-bottom: 1px solid #EBEBEB !important;
		}
		
		.border-top-white {
			border-top: 0px solid #EBEBEB !important;
		}
		
		.border-right0 {
			border-right: 0 !important;
		}
		
		.table-bordered {
			border-top: 0px solid #EBEBEB !important;
		}
		
		.dataTables_wrapper.no-footer .dataTables_scrollBody {
			border-bottom: 1px solid #EBEBEB;
		}
		
		.dataTables_wrapper {
			background-color: white;
		}
		
		.table-bordered>tbody>tr>td,
		.table-bordered>tbody>tr>th,
		.table-bordered>tfoot>tr>td,
		.table-bordered>tfoot>tr>th,
		.table-bordered>thead>tr>td,
		.table-bordered>thead>tr>th {
			border: 1px solid #e7e7e7;
			border-bottom: 0 !important;
			text-align: center !important;
		}
		
		.subbox {
			text-align: center;
			/*border-top: 1px solid #e7e7e7;*/
		}
		
		.subboxtd {
			padding: 0 !important;
			/*border-left: 1px solid #E7E7E7 !important;*/
			border-top: 1px solid #E7E7E7 !important;
		}
		
		.subboxtd2 {
			padding: 0 !important;
			border-right: 1px solid #E7E7E7 !important;
			border-top: 1px solid #E7E7E7 !important;
		}
		
		.tablepadding0 {
			text-align: center;
			padding: 0 !important;
		}
		
		.subtable {
			width: 100%;
		}
		
		table.dataTable tbody th,
		table.dataTable tbody td {
			padding: 0 !important;
		}
		
		table.dataTable {
			margin-top: 0 !important;
			margin-bottom: 0px !important;
			border-bottom: 1px solid #E7E7E7 !important;
		}
		table {
			background-color: white !important;
		}
	</style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="main" Runat="Server">
	<div class="system-box">
		<div class="right-side">
			<div class="btns-container">
				<button type="button" id="btn-search" class="btn btn-info" data-toggle="modal" data-target="#null"><i class="fa fa-search"></i>&nbsp;&nbsp;查询</button>
				<button type="button" id="calculateBtn" class="btn btn-primary" data-toggle="modal" data-target="#null"><i class="fa fa-edit"></i>&nbsp;&nbsp;计算</button>
			</div>
			<!--查询条件-->
			<div class="condition-container">
				<div class="form-inline" role="form" style="overflow: visible;padding: 10px 0;width:1035px;">
					<div class="form-group inputpadding0" style="display: inline-block !important;">
						<label for="search-Area" class="control-label">区域</label>
						<select id="search-Area" class="form-control selectpicker" data-width="120px" data-style="backselect"></select>
					</div>
					<div class="form-group inputpadding0" style="display: inline-block !important;">
						<label for="search-Kind" class="control-label">大类</label>
						<select id="search-Kind" class="form-control selectpicker" data-width="120px" data-style="backselect" data-live-search="true" multiple></select>
					</div>
					<div class="form-group inputpadding0" style="display: inline-block !important;">
						<label for="search-Item" class="control-label">子项</label>
						<select id="search-Item" class="form-control selectpicker" data-width="120px" data-style="backselect" data-live-search="true" multiple></select>
					</div>
					<div class="form-group inputpadding0" style="display: inline-block !important;">
						<label for="search-Gender" class="control-label">性别</label>
						<select id="search-Gender" class="form-control selectpicker" data-width="100px" data-style="backselect"></select>
					</div>
					<div class="form-group" style="display: inline-block !important;">
						<label>周：</label>
						<input type="tel" maxlength="2" placeholder="1" style="width: 80px;display: inline-block !important;" id="search-artnum" value="1" class="form-control" />
					</div>
					<div class="form-group" style="display: inline-block !important;">
						<label>至</label>
						<input type="tel" maxlength="2" placeholder="13" style="width: 80px;display: inline-block !important;" id="2" value="13" class="form-control" />
					</div>
				</div>
				<div class="cb"></div>
			</div>

			<div class="table-container no-padding">

				<table id="example" class="table table-bordered nowrap" cellspacing="0" width="100%">
					<thead>
						<tr>
							<th rowspan="2">区域数量</th>
							<th rowspan="2">大类</th>
							<th rowspan="2">子项</th>
							<th rowspan="2">性别</th>
							<th class="border-bottom-white">平均日</th>
							<th class="border-bottom-white">标准SKC</th>
							<th rowspan="2">平均单价</th>
							<th class="border-bottom-white">近30天销</th>
							<th class="border-bottom-white">预估占</th>
							<th class="border-bottom-white border-right0">单店单SKC数</th>
							<th rowspan="2" style="border-left:1px solid #E7E7E7;border-left:1px solid #E7E7E7;">周</th>
							<th colspan="2" class="border-bottom-white">销售</th>
							<!--<th></th>-->
							<th colspan="2" class="border-bottom-white">陈列</th>
							<!--<th>需求金额</th>-->
							<th colspan="3" class="border-bottom-white">半有效</th>
							<!--<th>总金额</th>
								<th>SKC数</th>-->
							<th colspan="3" class="border-bottom-white">有效</th>
							<!--<th>金额</th>
								<th>SKC数</th>-->
							<th class="border-bottom-white">合计</th>
							<th colspan="3" class="border-bottom-white">SKC缺口</th>
							<!--<th>金额</th>
								<th>SKC数</th>-->
							<th colspan="3" class="border-bottom-white">畅销SKC缺口</th>
							<!--<th>金额</th>
								<th>SKC数</th>-->
							<th colspan="3" class="border-bottom-white">其他缺口</th>
							<!--<th>数量</th>
								<th>金额</th>-->
						</tr>
						<tr>
							<!--<th>区域</th>-->
							<!--<th>大类</th>
								<th>子项</th>
								<th>性别</th>-->
							<th class="border-top-white">均销</th>
							<th class="border-top-white">数量</th>
							<!--<th>平均单价</th>-->
							<th class="border-top-white">售占比</th>
							<th class="border-top-white">比</th>
							<th class="border-top-white border-right0">标准陈列量</th>
							<!--<th></th>-->
							<th>需求数</th>
							<th>需求吊牌额</th>
							<th>需求数</th>
							<th>需求金额</th>
							<th>总数量</th>
							<th>总金额</th>
							<th>SKC数</th>
							<th>数量</th>
							<th>金额</th>
							<th>SKC数</th>
							<th>SKC数</th>
							<th>数量</th>
							<th>金额</th>
							<th>SKC数</th>
							<th>数量</th>
							<th>金额</th>
							<th>SKC数</th>
							<th>宽度</th>
							<th>数量</th>
							<th>金额</th>
						</tr>
					</thead>

				</table>
			</div>
			<%--<div class="pageControl"></div>--%>
		</div>
	</div>

</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="footer" Runat="Server">
	<script src="../assets/js/framework.js"></script>
	<script src="../assets/js/page/rScroll.js"></script>
	<script src="../assets/js/page/pageControl.js"></script>
	<script src="../assets/js/page/tableControl.js"></script>
	<script src="../assets/js/plugins/iCheck/icheck.min.js"></script>
	<script src="../assets/js/plugins/iCheck/icheckAll.js"></script>
	<script src="../assets/js/plugins/layer/laydate/laydate.js"></script>
	<script src="../assets/js/common.js" type="text/javascript" charset="utf-8"></script>
	<script src="../assets/js/plugins/bootstrap-select/bootstrap-select.min.js"></script>
	<script src="../assets/js/plugins/bootstrap-select/i18n/defaults-zh_CN.min.js"></script>
	<!--<script src="https://cdn.datatables.net/1.10.15/js/jquery.dataTables.min.js" type="text/javascript" charset="utf-8"></script>-->
	<script src="../assets/js/plugins/jQuery-DataTables/jquery.dataTables.min.js"></script>
	<script src="../assets/js/plugins/jQuery-DataTables/dataTables.bootstrap.js"></script>
	<script src="../assets/js/plugins/jQuery-DataTables/dataTables.fixedColumns.min.js" type="text/javascript" charset="utf-8"></script>
	<script>
		$(document).ready(function() {

			var btnindex = layer.load(0, {
				shade: false
			});
			//诺米通用绑定下拉框
			var nmCommonBindList = function(controller, action, params, els, value, text, size, callback) {
				Y.API2(controller, action, params, function(data) {
					if(data.Success == false) {
						swal(data.Message, '', 'error');
					} else {
						var html = '';
						data.map(function(item) {
							html += '<option value=' + item[value] + '>' + item[text] + '</option>';
						});
						els.map(function(item) {
							$(item).append(html);
							$(item).selectpicker({
								size: size,
								'title': '请选择'
							});
							$(item).selectpicker('refresh');
						});
						if(typeof callback === "function") {
							callback();
						}
					}
				});
			}

			//区域
			var nmGetBasOperationAreaList = function(els, size, callback) {
				//nmCommonBindList('ShopPlanning', 'GetBasOperationAreaList', {}, els, 'OperationAreaName', 'OperationAreaName', size, true, callback);
				var value = 'OperationAreaName';
				Y.API2('ShopPlanning', 'GetBasOperationAreaList', {}, function(data) {

					if(data.Success == false) {
						swal(data.Message, '', 'error');
					} else {
						var html = '<option value="">请选择</option>';
						html += '<option value="全国">全国</option>';
						data.map(function(item) {
							html += '<option value=' + item["OperationAreaID"] + '>' + item["OperationAreaName"] + '</option>';
						});
						els.map(function(item) {
							$(item).append(html);
							$(item).selectpicker({
								size: size || 8,
								'title': '请选择'
							});
							$(item).selectpicker('refresh');
						});
						if(typeof callback === "function") {
							callback();
						}
					}
				});
			}
			//大类
			var nmGetKindInfo = function(els, callback) {
				nmCommonBindList('Common', 'GetKindInfo', {}, els, 'KindID', 'KindName', 6, callback);
			}
			//子项
			var nmGetItemInfo = function(els, params, callback) {
				nmCommonBindList('Common', 'GetItemInfo', {
					kindIds: params
				}, els, 'ItemorSub', 'ItemorSub', 6, callback);
			}
			//性别
			var nmGetSexList = function(els, callback) {
				nmCommonBindList('Common', 'GetSexInfo', {}, els, 'SexId', 'SexName', 6, callback);
			}
			//年份/季节
			var nmGetYearOrSeason = function(els, params, callback) {
				nmCommonBindList('DwGlobalVariable', 'GetGlobalVariableList', params, els, 'dictValue', 'dictName', 6, callback);
			};

			nmGetBasOperationAreaList(['#search-Area']);
			nmGetKindInfo(['#search-Kind']);
			nmGetSexList(['#search-Gender']);
			//年份
			nmGetYearOrSeason(['#search-year'], {
				dictValue: '年份'
			});
			//季节
			nmGetYearOrSeason(['#search-season'], {
				dictValue: '季节'
			});

			//大类获取小类
			$(document).on("change", "#search-Kind", function() {
				//console.log("触发了原生的change事件!");
				$("#search-ItemID").html('<option value="">请选择</option>');
				var ids = $(this).val();

				if(ids == "" || ids == null) {
					return;
				}
				nmGetItemInfo(['#search-Item'], ids.join(',')); //小品类
			});

			//计算表格高度
			var ua = navigator.userAgent.toLowerCase();
			var calcTableHeight = function() {
				var tableHeight = 0;
				//开始时候表格可能没有初始化,取默认高度40
				var headHeight = $('.dataTables_scrollHead').outerHeight() || 40;
				//提供不同浏览器兼容计算
				if(ua.indexOf('chrome') > -1) {
					tableHeight = $('.right-side').outerHeight() - $('.btns-container').outerHeight() - $('.condition-container').outerHeight() - headHeight - 55;
				} else {
					tableHeight = $('.right-side').outerHeight() - $('.btns-container').outerHeight() - $('.condition-container').outerHeight() - headHeight - 55;
				}
				//必须用css方式设定，直接用.height()有时候会差60px
				$('.dataTables_scrollBody').css({
					height: tableHeight + 'px'
				});
				return calcTableHeight;
			}

			//处理数据
			var ProcessData = function(result) {
				if(result.Success === false) {
					swal(result.Message, '', 'error');
					return [];
				} else {
					//					console.log(result)
					result.Data.Items.map(function(v) {
						v.WeeklyItemList.sort(function(a, b) {
							return a.WeekNo - b.WeekNo;
						})
					})
					result.draw = table.ajax.params().draw;
					result.recordsTotal = result.Data.RecordCount;
					result.recordsFiltered = result.Data.RecordCount;
					result.data = result.Data.Items;
					layer.close(btnindex);
					return result.data;
				}
			}
			//遍历数据
			var subMap = function(data, playload) {
				if(playload == 'WeekNo') {
					var content = '';
					data.map(function(s) {
						content += '<tr class="subbox"><td class="subboxtd2">' + (s[playload] == null || s[playload] == 0 ? '&nbsp' : s[playload]) + '</td></tr>';
					})
					return '<table class="subtable">' + content + '</table>';
				}
				var content = '';
				data.map(function(s) {
					content += '<tr class="subbox"><td class="subboxtd">' + (s[playload] == null || s[playload] == 0 ? '&nbsp' : s[playload]) + '</td></tr>';
				})

				return '<table class="subtable">' + content + '</table>';
			}
			//数据为空或0的处理
			var numSet = function(data, type, row, meta) {
				if(data == null || data == 0) {
					return "&nbsp"
				}
				return data;
			}
			//绑定列
			var columns = [{ //区域ID
					"data": "ParentAreaID",
					"className": "border-right1",
					"render": numSet
				},
				{ //类别
					"data": "KindName",
					"className": "border-right1",
					"render": numSet
				},
				{ //子项目
					"data": "ItemOrSub",
					"className": "border-right1",
					"render": numSet
				},
				{ //性别
					"data": "SexID",
					"className": "border-right1",
					"render": function(data, type, row, meta) {
						if(data == 000003) {
							return "中性"
						} else if(data == 000002) {
							return "女"
						} else if(data == 000001) {
							return "男";
						}
						return "&nbsp";
					}
				},
				{ //平均日销量
					"data": "AvgSaleQty",
					"className": "border-right1",
					"render": numSet
				},
				{ //	标准SKC数量
					"data": "SKCQty",
					"className": "border-right1",
					"render": numSet
				},
				{ //平均单价
					"data": "AvgPrice",
					"className": "border-right1",
					"render": function(data, type, row, meta) {
						if(data == null || data == 0) {
							return "&nbsp"
						}
						return parseInt(data);
					}
				},
				{ //MonthSaleRate
					"data": "MonthSaleRate",
					"className": "border-right1",
					"render": numSet
				},
				{ //预估占比
					"data": "PredictRate",
					"className": "border-right1",
					"render": numSet
				},
				{ //单店单SKC标准陈列量
					"data": "ShopSKCDisplayQty",
					"className": "border-right1",
					"render": numSet
				},
				{ //周.WeekNo
					"data": "WeeklyItemList",
					"className": "tablepadding0",
					"render": function(data, type, row, meta) {
						var subcontent = subMap(data, "WeekNo");
						return subcontent;
					}
				}, { //销售需求数SaleQty
					"data": "WeeklyItemList",
					"className": "tablepadding0",
					"render": function(data, type, row, meta) {
						var subcontent = subMap(data, "SaleQty");
						return subcontent;
					}
				}, { //需求吊牌额SaleTagAmount
					"data": "WeeklyItemList",
					"className": "tablepadding0",
					"render": function(data, type, row, meta) {
						var subcontent = subMap(data, "SaleTagAmount");
						return subcontent;
					}
				}, { //需求数 DisplayQty
					"data": "WeeklyItemList",
					"className": "tablepadding0",
					"render": function(data, type, row, meta) {
						var subcontent = subMap(data, "DisplayQty");
						return subcontent;
					}
				}, { //需求金额 DisplayTagAmount
					"data": "WeeklyItemList",
					"className": "tablepadding0",
					"render": function(data, type, row, meta) {
						var subcontent = subMap(data, "DisplayTagAmount");
						return subcontent;
					}
				}, { //半有效总数量 SumHalfValidSKCQty
					"data": "WeeklyItemList",
					"className": "tablepadding0",
					"render": function(data, type, row, meta) {
						var subcontent = subMap(data, "SumHalfValidSKCQty");
						return subcontent;
					}
				}, { //半有效总金额 SumHalfValidSKCAmount
					"data": "WeeklyItemList",
					"className": "tablepadding0",
					"render": function(data, type, row, meta) {
						var subcontent = subMap(data, "SumHalfValidSKCAmount");
						return subcontent;
					}
				}, { //半有效SKC数  HalfValidSKCQty
					"data": "WeeklyItemList",
					"className": "tablepadding0",
					"render": function(data, type, row, meta) {
						var subcontent = subMap(data, "HalfValidSKCQty");
						return subcontent;
					}
				}, { //有效数量 SumValidSKCQty
					"data": "WeeklyItemList",
					"className": "tablepadding0",
					"render": function(data, type, row, meta) {
						var subcontent = subMap(data, "SumValidSKCQty");
						return subcontent;
					}
				}, { //有效金额 SumValidSKCAmount
					"data": "WeeklyItemList",
					"className": "tablepadding0",
					"render": function(data, type, row, meta) {
						var subcontent = subMap(data, "SumValidSKCAmount");
						return subcontent;
					}
				}, { //有效SKC数 ValidSKCQty
					"data": "WeeklyItemList",
					"className": "tablepadding0",
					"render": function(data, type, row, meta) {
						var subcontent = subMap(data, "ValidSKCQty");
						return subcontent;
					}
				}, { //合计 TotalValidSKCQty
					"data": "WeeklyItemList",
					"className": "tablepadding0",
					"render": function(data, type, row, meta) {
						var subcontent = subMap(data, "TotalValidSKCQty");
						return subcontent;
					}
				}, { //SKC缺口数量 QtyGap
					"data": "WeeklyItemList",
					"className": "tablepadding0",
					"render": function(data, type, row, meta) {
						var subcontent = subMap(data, "QtyGap");
						return subcontent;
					}
				}, { //SKC缺口金额 AmountGap
					"data": "WeeklyItemList",
					"className": "tablepadding0",
					"render": function(data, type, row, meta) {
						var subcontent = subMap(data, "AmountGap");
						return subcontent;
					}
				}, { //SKC缺口SKC数 SKCWidthGap
					"data": "WeeklyItemList",
					"className": "tablepadding0",
					"render": function(data, type, row, meta) {
						var subcontent = subMap(data, "SKCWidthGap");
						return subcontent;
					}
				}, { //畅销SKC缺口数量  CQtyGap
					"data": "WeeklyItemList",
					"className": "tablepadding0",
					"render": function(data, type, row, meta) {
						var subcontent = subMap(data, "CQtyGap");
						return subcontent;
					}
				}, { //畅销SKC缺口金额 CAmountGap
					"data": "WeeklyItemList",
					"className": "tablepadding0",
					"render": function(data, type, row, meta) {
						var subcontent = subMap(data, "CAmountGap");
						return subcontent;
					}
				}, { //畅销SKC缺口SKC数 CSKCGap
					"data": "WeeklyItemList",
					"className": "tablepadding0",
					"render": function(data, type, row, meta) {
						var subcontent = subMap(data, "CSKCGap");
						return subcontent;
					}
				}, { //其他缺口宽度 OtherWidthGap
					"data": "WeeklyItemList",
					"className": "tablepadding0",
					"render": function(data, type, row, meta) {
						var subcontent = subMap(data, "OtherWidthGap");
						return subcontent;
					}
				}, { //其他缺口数量 OtherQtyGap
					"data": "WeeklyItemList",
					"className": "tablepadding0",
					"render": function(data, type, row, meta) {
						var subcontent = subMap(data, "OtherQtyGap");
						return subcontent;
					}
				}, { //其他缺口金额 OtherAmountGap
					"data": "WeeklyItemList",
					"className": "tablepadding0",
					"render": function(data, type, row, meta) {
						var subcontent = subMap(data, "OtherAmountGap");
						return subcontent;
					}
				}
			];

			function reloadAjaxsend() { //获取请求数据时的参数
				var kindArr = getVal('#search-Kind');
				var kinds = "";
				if(kindArr != null) {
					kinds = kindArr.join(',');
				}

				var itemArr = getVal('#search-Item');
				var items = "";
				if(itemArr != null) {
					items = itemArr.join(',');
				}

				var send = {
					ParentAreaID: getVal('#search-Area'), //地区
					KindID: kinds, //大类
					ItemOrSub: items, //小类
					SexID: getVal('#search-Gender'), //性别
					StartWeekNo: getVal('#search-artnum'), //周
					EndWeekNo: getVal('#2')
				};
				return send;
			}

			//生成表格
			var ajaxOptions = {
				url: '/api.ashx?c=GoodsKindGapCalc&a=GetGoodsKindGapCalcBaseItemList&u=',
				type: "POST",
				dataSrc: ProcessData,
				data: function(condition) {
					condition.Page = (condition.start / condition.length) + 1;
					condition.Size = condition.length;
					//					console.log(condition)
				},
			}
			var table = $('#example').DataTable({
				language: {
					url: '../assets/js/plugins/jQuery-DataTables/i18n/Chinese.json'
				},
				searching: false,
				paging: true,
				info: false,
				ordering: false,
				lengthChange: false,
				processing: true,
				pagingType: "simple_numbers",
				scrollY: calcTableHeight(),
				scrollX: true,
				scrollCollapse: true,
				serverSide: true, //开启服务器分页模式
				pageLength: 10,
				fixedColumns: {
					leftColumns: 11
				},
				initComplete: function(settings, json) {
					//表格初始化完毕立即计算一次
					calcTableHeight();
					table.columns.adjust().draw();
				},
				drawCallback: function(settings) {},
				ajax: ajaxOptions,
				columns: columns,
			});
			var isInteger = function(obj) {
				return typeof obj === 'number' && obj % 1 === 0
			}

			//加载列表数据
			var loadList = function() {
				var kindArr = getVal('#search-Kind');
				var kinds = "";
				if(kindArr != null) {
					kinds = kindArr.join(',');
				}

				var itemArr = getVal('#search-Item');
				var items = "";
				if(itemArr != null) {
					items = itemArr.join(',');
				}
				table.settings()[0].ajax.data = function(d) {
					d.ParentAreaID = $('#search-Area').val();
					d.KindID = kinds;
					d.ItemOrSub = items;
					d.SexID = $('#search-Gender').val();
					d.MaterialID = $('#search-artnum').val();
					d.StartWeekNo = getVal('#search-artnum'); //周
					d.EndWeekNo = getVal('#2');
					d.Page = (d.start / d.length) + 1;
					d.Size = d.length;
				};
				table.ajax.reload(function() {
					//重新计算列宽
					table.columns.adjust().draw();

				}, false);
			}

			//查询按钮
			var getVal = function(v) { //获取按钮值
				return $(v).val();
			}
			$('.btns-container').on('click', '#btn-search', function() {
				loadList();
			});
			
			$('.btns-container').on('click', '#calculateBtn', function () {
            layer.msg('正在计算，请耐心等待',
                {
                    icon: 16,
                    shade: 0.5,
                    time: 0,
                    maxWidth: 200,
                    area: ['230px', '75px']
                });

            Y.API2("GoodsKindGapCalc", "CalGoodsKindGapCalc", {}, function (data) {
                layer.closeAll('dialog');
                if (data.Success == false) {
                    swal(data.Message, '', 'error');
                } else {
                     console.log(data)
                    //table.clear();
                    loadList();
                }
            });
        });

			//周查询输入控制
			$('input[type="tel"]').keyup(function() {
				var inputNums = $(this).val();
				if(inputNums == 0 || inputNums > 13 || !/^[0-9]+$/.test(inputNums)) {
					$(this).val('')
				}
			})

			//单行点击高亮
			$('#table').on('click', 'tr', function() {
				if($(this).hasClass('selected')) {
					$(this).removeClass('selected');
				} else {
					table.$('tr.selected').removeClass('selected');
					$(this).addClass('selected');
					//获取选中行
					var tr = table.row('.selected').node();

				}
			});

			//重新计算表格高度
			$(window).resize(function() {
				calcTableHeight();
			});

			calcTableHeight();

		});
	</script>
</asp:Content>